<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: 98103
  Date: 2020/7/21
  Time: 20:09
  To change this template use File | Settings | File Templates.
--%>
<%--导入jstl标签库 --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>JSTL</title>
</head>
<body>
<% pageContext.setAttribute("score","A"); %>
<c:if test="${pageScope.score eq 'A'}">
    优秀
</c:if><br/>
<% pageContext.setAttribute("score","E"); %>

<c:choose>
    <c:when test="${pageScope.score eq 'A'}">优秀</c:when>
    <c:when test="${pageScope.score eq 'B'}">良好</c:when>
    <c:when test="${pageScope.score eq 'C'}">一般</c:when>
    <c:when test="${pageScope.score eq 'D'}">较差</c:when>
    <c:otherwise>设置错误</c:otherwise>
</c:choose>
<br/>
<%
    ArrayList<String> list = new ArrayList<>();
    list.add("aaa");
    list.add("bbb");
    list.add("ccc");
    list.add("ddd");
    list.add("eee");
    list.add("fff");
    pageContext.setAttribute("list",list);
%>

<c:forEach items="${list}" var="s">
    ${s}<br/>
</c:forEach>

<c:forEach begin="1" end="5" var="num">
    ${num}<br/>
</c:forEach>
</body>
</html>
